home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: gail.ripco.com!mambuhl
- From: mambuhl@ripco.com (Martin Ambuhl)
- Subject: Re: Q:Hex to Decimal?
- Message-ID: <DpqLyJ.8Jy@rci.ripco.com>
- X-Nntp-Sender: mambuhl@golden.ripco.com
- Sender: usenet@rci.ripco.com (Net News Admin)
- Organization: Ripco Internet BBS Chicago
- Date: Fri, 12 Apr 1996 06:56:43 GMT
-
- Thomas A Cooper <tacooper@tricon.net> in <316D2289.4759@tricon.net>
- asks:
-
- >I saw in a magazine a simple function to convert a HEX string to an
- >integer:
-
- #define FAR /* to make the following compilable */
- #define PASCAL
-
- >long int FAR PASCAL hex2int(char far *s)
- >{
- > return strtol(s,NULL,16);
- >}
-
- > I'm struggling with the reverse situation, a function to convert an
- >integer into a HEX string. Anybody got any ideas?? Thanks in advance for
- >your help.
-
- sprintf(target_string,"x",(unsigned)your_integer);
-
-
- --
- * Martin Ambuhl net: mambuhl@ripco.com
- * Chicago, IL (USA)
-